﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HotelManager.Facility;
using HotelManager.Person;

namespace HotelManager
{
    class Start // Renamed because of Compile Error: 'Main': member names cannot be the same as their enclosing type
    {
        static void Main()
        {
            // Creating Receptionist
            Receptionist recepOne = new Receptionist(123, "Penka", 600);
            recepOne.Languages = new List<Languages>();
            recepOne.Languages.Add(Languages.BG);
            recepOne.Languages.Add(Languages.RU);
            recepOne.Languages.Add(Languages.DE);
            recepOne.Languages.Add(Languages.EN);
            // Creating client
            Client clientOne = new Client(456, "Georgi Iliev");

            //{ //IComunicate test
            //    Console.WriteLine("IComunicate test:");
            //    Console.WriteLine(rc1.Welcome(Languages.EN));
            //    try
            //    {
            //        Console.WriteLine(rc1.SayIt(Languages.EN, "How are you today?"));
            //    }
            //    catch (PersonException)
            //    {
            //        Console.WriteLine("Excuse me, I can't translate this. No connection to my brain!");
            //    }
            //    Console.WriteLine(rc1.GoodBye(Languages.EN));
            //    Console.WriteLine();
            //    Console.WriteLine(rc1.Welcome(Languages.RU));
            //    try
            //    {
            //        Console.WriteLine(rc1.SayIt(Languages.RU, "How are you today?"));
            //    }
            //    catch (PersonException)
            //    {
            //        Console.WriteLine("Excuse me, I can't translate this. No connection to my brain!");
            //    }
            //    Console.WriteLine(rc1.GoodBye(Languages.RU));
            //    Console.WriteLine();
            //    Console.WriteLine(rc1.Welcome(Languages.BG));
            //    try
            //    {
            //        Console.WriteLine(rc1.SayIt(Languages.BG, "How are you today?"));
            //    }
            //    catch (PersonException)
            //    {
            //        Console.WriteLine("Excuse me, I can't translate this. No connection to my brain!");
            //    }
            //    Console.WriteLine(rc1.GoodBye(Languages.BG));
            //    Console.WriteLine();
            //    Console.WriteLine(rc1.Welcome(Languages.DE));
            //    try
            //    {
            //        Console.WriteLine(rc1.SayIt(Languages.DE, "How are you today?"));
            //    }
            //    catch (PersonException)
            //    {
            //        Console.WriteLine("Excuse me, I can't translate this. No connection to my brain!");
            //    }
            //    Console.WriteLine(rc1.GoodBye(Languages.DE));
            //    Console.WriteLine();
            //}
            //IPay test
            Console.WriteLine("IPay test:");
            Console.WriteLine(clientOne.Name + "'s balance: " + clientOne.Ballance());
            clientOne.CollectMoney(165.98M);
            Console.WriteLine(clientOne.Name + "'s balance, after CollectMoney(): " + clientOne.Ballance());
            recepOne.CollectMoney(clientOne.PayMoney(93M));
            Console.WriteLine(recepOne.Name + "'s balance, after CollectMoney(): " + recepOne.Ballance());
            Console.WriteLine(clientOne.Name + "'s balance, after PayMoney(): " + clientOne.Ballance());
            // Create hotel, personel and client
            Hotel hotelOne = new Hotel(Category.FiveStar);
            //When creating a room we should set it as free, clean and some beds inside
            Room room1 = new Room(RoomKind.Dbl, 2);
            hotelOne.AddRoom(room1, 2);
            Room room2 = new Room(RoomKind.Sgl, 1);
            hotelOne.AddRoom(room2, 3);
            

            Manager manager = new Manager(1245, "Petar Petrov", 2350);
            Housekeeping maid = new Housekeeping(5469, "Kaka Sijka", 150);
            hotelOne.HirePersonel(manager); // Managers can be hired only by Hotels
            manager.HirePersonel(recepOne); // Other personel can be hired by Managers
            manager.HirePersonel(maid);
            Console.WriteLine();
            Console.WriteLine("Get all Receptionists:");
            Console.WriteLine(hotelOne.GetPersonalByType(typeof(Receptionist)));

            Console.WriteLine("Get all Personel:");
            Console.WriteLine(hotelOne.GetPersonalByType(typeof(Personel)));

            List<Client> clients = new List<Client>();
            clients.Add(clientOne);
            //IAccommodate test
            ushort inRoom1 = recepOne.CheckIn(clients);
            ushort inRoom2 = recepOne.CheckIn(clients);
            Console.WriteLine("List of rooms after checkin:");
            Console.WriteLine(hotelOne.ListRooms());
            recepOne.CheckOut(inRoom1);
            recepOne.CheckOut(inRoom2);
            maid.CleanRoom(inRoom1); //inRoom2 will remain unclean :) 
            Console.WriteLine("List of rooms after checkout:");
            Console.WriteLine(hotelOne.ListRooms());
        }
    }
}